import { createStore, applyMiddleware, combineReducers } from 'redux'

import * as reducers from '../reducers'
const reducer = combineReducers(reducers)

import mySaga from '../sagas'
import createSagaMiddleware from 'redux-saga'
const sagaMiddleware = createSagaMiddleware()

export default function configureStore(initialState) {
  const store = applyMiddleware( sagaMiddleware
  ) (createStore)(reducer, initialState)
  sagaMiddleware.run(mySaga)
  return store
}
